import requests

# res = requests.get('https://www.baidu.com')

# print(res.cookies.get_dict())

# session 会话  在多次请求中共享cookie
data = {
  'email': '18838517172',
  'password': 't199505216910'
}
header = {
  'User-Agent':'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.149 Safari/537.36'
}

login_url = 'http://www.renren.com/PLogin.do'
dapeng_url = 'http://www.renren.com/880151247/profile'

session = requests.session()

session.post(login_url, data = data, headers = header)

resp = session.get(dapeng_url)

print(resp.encoding)

with open('python/pachong/renren.html', 'w', encoding='utf-8') as fp:
  fp.write(resp.text)


# requests.get(url, verify=False)

